package com.nuanshui.heatedloan.userinfo.dal.mapper;

import com.nuanshui.heatedloan.userinfo.model.IntegralAction;
import com.nuanshui.heatedloan.userinfo.model.IntegralRank;
import com.nuanshui.heatedloan.userinfo.model.UserExchangeIntegral;
import com.nuanshui.heatedloan.userinfo.model.UserIntegral;
import org.apache.ibatis.annotations.Param;

import java.util.List;




public interface UserIntegralMapper {
	/**
	 * 保存用户的获取积分的记录
	 * @param userIntegral
	 */
    void save(UserIntegral userIntegral);
	
	/**
	 * 更新用户的总分数
	 */
    void updateUserTotalIntegral(@Param("userId") String userId, @Param("score") Double score);
	
    /**
     * 获取所有的用户等级
     * @return
     */
    List<IntegralRank> findAllIntegralRank();
	
	/**
	 * 获取所有的获取积分的途径
	 * @return
	 */
    List<IntegralAction>  findAllIntegralAction();
	
	Integer getContinuousTime(@Param("userId") String userId, @Param("actionCode") String actionCode, @Param("date") String date);
	
	/**
	 * 兑换积分
	 */
    void exchangeIntegral(UserExchangeIntegral userExchangeIntegral);
	
	
	void unExchangeIntegral(@Param("orderNum") String orderNum);
	
	UserExchangeIntegral loadExchangeIntegral(@Param("orderNum") String orderNum);
	
	
	/**
	 * 获取用户剩余积分
	 * @return
	 */
    Long loadSurplusIntegral(@Param("userId") String userId);
}
